home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 131 / XENIATGM131.iso / Shareware / openOffice.org 641 / Linux / f0_013 / sopatchlevel.sh
Linux/UNIX/POSIX Shell Script  |  2001-12-19  |  5KB  |  170 lines

  1. #!/bin/sh
  2. #*************************************************************************
  3. #
  4. #   $RCSfile: sopatchlevel.sh,v $
  5. #
  6. #   $Revision: 1.4 $
  7. #
  8. #   last change: $Author: ok $ $Date: 2001/11/05 10:30:59 $
  9. #
  10. #   The Contents of this file are made available subject to the terms of
  11. #   either of the following licenses
  12. #
  13. #          - GNU Lesser General Public License Version 2.1
  14. #          - Sun Industry Standards Source License Version 1.1
  15. #
  16. #   Sun Microsystems Inc., October, 2000
  17. #
  18. #   GNU Lesser General Public License Version 2.1
  19. #   =============================================
  20. #   Copyright 2000 by Sun Microsystems, Inc.
  21. #   901 San Antonio Road, Palo Alto, CA 94303, USA
  22. #
  23. #   This library is free software; you can redistribute it and/or
  24. #   modify it under the terms of the GNU Lesser General Public
  25. #   License version 2.1, as published by the Free Software Foundation.
  26. #
  27. #   This library is distributed in the hope that it will be useful,
  28. #   but WITHOUT ANY WARRANTY; without even the implied warranty of
  29. #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  30. #   Lesser General Public License for more details.
  31. #
  32. #   You should have received a copy of the GNU Lesser General Public
  33. #   License along with this library; if not, write to the Free Software
  34. #   Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  35. #   MA  02111-1307  USA
  36. #
  37. #
  38. #   Sun Industry Standards Source License Version 1.1
  39. #   =================================================
  40. #   The contents of this file are subject to the Sun Industry Standards
  41. #   Source License Version 1.1 (the "License"); You may not use this file
  42. #   except in compliance with the License. You may obtain a copy of the
  43. #   License at http://www.openoffice.org/license.html.
  44. #
  45. #   Software provided under this License is provided on an "AS IS" basis,
  46. #   WITHOUT WARRUNTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
  47. #   WITHOUT LIMITATION, WARRUNTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
  48. #   MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
  49. #   See the License for the specific provisions governing your rights and
  50. #   obligations concerning the Software.
  51. #
  52. #   The Initial Developer of the Original Code is: Sun Microsystems, Inc..
  53. #
  54. #   Copyright: 2000 by Sun Microsystems, Inc.
  55. #
  56. #   All Rights Reserved.
  57. #
  58. #   Contributor(s): _______________________________________
  59. #
  60. #
  61. #
  62. #*************************************************************************
  63.  
  64. sd_inst="`dirname "$0"`"
  65. sd_platform=`uname -s`
  66.  
  67. if [ "$sd_platform"="SunOS" ]; then
  68.     #
  69.     # check required patchid
  70.     #
  71.  
  72.     sd_hardware=`uname -p`
  73.     sd_release=`uname -r`
  74.     required_patch=
  75.  
  76.     case $sd_hardware in
  77.     i386)
  78.         case $sd_release in
  79.             5.6)
  80.             required_patch=104678
  81.                 required_minor=7
  82.             ;;
  83.             5.7)
  84.                 required_patch=106328
  85.                   required_minor=8
  86.                 ;;
  87.                     5.8)
  88.                 required_patch=108436
  89.                         required_minor=1
  90.                         ;;
  91.         esac
  92.         ;;
  93.     sparc)
  94.         case $sd_release in
  95.             5.6)
  96.             required_patch=105591
  97.                 required_minor=9
  98.                         ;;
  99.           5.7)
  100.             required_patch=106327
  101.                 required_minor=8
  102.               ;;
  103.                     5.8)
  104.             required_patch=108434
  105.                 required_minor=1
  106.                         ;;
  107.         esac
  108.     esac
  109.  
  110.     if [ "$ignore_patch_check" != "" ]; then
  111.         echo WARNING! overriding patch check!
  112.         required_patch=
  113.     fi
  114.  
  115.     #
  116.     # if no patch is required we are done
  117.     #
  118.  
  119.     if [ "$required_patch" = "" ]; then
  120.         exit 0
  121.     fi
  122.  
  123.     #
  124.     # check prerequesites
  125.     #
  126.  
  127.     if [ ! -x /usr/bin/awk ]; then
  128.         exit 0
  129.     fi
  130.  
  131.     #
  132.     # check installed patches
  133.     #
  134.     patch_installed=`"$sd_inst"/sorev -l SUNWlibC | /usr/bin/awk \
  135.         '{ \
  136.             if ($1 == "Patch:") { \
  137.                 split($2, inst_patch, "-"); \
  138.                 if (inst_patch[1] == required_patch) { \
  139.                     if ((inst_patch[2]+1) >= (1+required_minor)){ \
  140.                         print "done"; exit 0; \
  141.                     } \
  142.                 } \
  143.              } \
  144.             if ($3 == "Obsoletes:") { \
  145.                 split($4, inst_patch, "-"); \
  146.                 if (inst_patch[1] == required_patch) { \
  147.                     if ((inst_patch[2]+1) >= (1+required_minor)){ \
  148.                         print "done"; exit 0; \
  149.                     } \
  150.                 } \
  151.              } \
  152.         }' required_patch=$required_patch required_minor=$required_minor `
  153.  
  154.     if [ "$patch_installed" = "done" ]; then
  155.         exit 0
  156.     else
  157.         case $sd_hardware in
  158.         i386)
  159.                 echo "Operating system update required. Please install the following patches.  Solaris 7: 106328-08; Solaris 8: 108436-01, 108774-12"
  160.         ;;
  161.         sparc)
  162.                 echo "Operating system update required. Please install the following patches. Solaris 7: 106327-08, 106300-09 (64 bit only); Solaris 8: 108434-01, 108773-12, 108435-01 (64 bit only)"
  163.                 ;;
  164.     esac
  165.         exit 1
  166.     fi
  167. fi
  168.  
  169. exit 0
  170.